Bentley Map V8i (SELECTseries 10) Help

Conditional Execution of Commands Scripts

The validation rules can be made conditional using an IF-END structure. The general syntax for this structure is:



Only one of the blocks will be executed. The first condition that evaluates to true results in the execution of the commands in the following block.

In the above example, if the expression “condition1” evaluates to true, only the commands in “command block 1” will be executed. If “condition1” is false and the expression “condition2” evaluates to true, only the commands in “command block2” are executed. If none of the conditions in the IF and ELSEIF statements evaluate to true, only the commands in the ELSE part are executed (command block N).

Tip:
  • The IF-END part is required but the ELSEIF and ELSE parts are optional.

  • It is possible to have zero, one, or more ELSEIF statements following the IF statement.

  • It is possible to have only one ELSE statement, which should be the last (before END).

  • It is possible to have nested IF-END structures.

  • It is possible to use the logical AND/OR operators when evaluating a larger expression.

  • It is possible to use the logical NOT operator to change the Boolean value of an expression.

  • All expressions must be enclosed in brackets ( ).

Use either a nested IF expression or the AND operator to evaluate an expression.

Example:



In both cases the commands are only executed if the material is concrete and the dimension is larger than 100.

Example:



In this example the weight of the graphical element is based on the size of the dimension stored in the pipe table in the database.